#include <iostream>
#include "SmartPtr.hpp"
#include "vld.h"

using namespace smart_ptr;
using std::cout;
using std::endl;

void test1()
{
	int* p = new int(100);
	unique_ptr<int> up(p);

	cout << *up << endl;
}

void test2()
{
	int* p1 = new int(5);

	shared_ptr<int> sp1(p1);
	cout << sp1.use_count() << endl;
	shared_ptr<int> sp2;
	sp2 = sp1;
	cout << sp1.use_count() << endl;
	cout << sp2.use_count() << endl;
}

class ListNode
{
public:
	ListNode(int val = 1) : _val(val), _prev(nullptr), _next(nullptr) {}

	int _val;
	weak_ptr<ListNode> _prev;
	weak_ptr<ListNode> _next;
};
void test3()
{
	ListNode* n1 = new ListNode;
	ListNode* n2 = new ListNode;

	shared_ptr<ListNode> sp1(n1);
	shared_ptr<ListNode> sp2(n2);

	sp1->_next = sp2;
	sp2->_prev = sp1;
}



int main()
{
	//test1();
	//test2();
	test3();

	return 0;
}